-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Viewer3D] Input bounding box (Meshing) & manual transformation (SfMTransform) thanks to a new 3D Gizmo #978
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fabiencastan
changed the title
[ui] Viewer3D: add a Transform Gizmo
Meshing: Add an input bounding box with a new 3D Gizmo
Jul 17, 2020
julien-hdev
force-pushed
the
dev/transformGizmo3D
branch
from
July 20, 2020 09:55
b9e4241
to
6804fb6
Compare
julien-hdev
force-pushed
the
dev/transformGizmo3D
branch
from
July 29, 2020 16:54
47bb6e0
to
5eb9278
Compare
julien-hdev
changed the title
Meshing: Add an input bounding box with a new 3D Gizmo
[Viewer3D] Input bounding box (Meshing) & manual transformation (SfMTransform) thanks to a new 3D Gizmo
Jul 29, 2020
fabiencastan
reviewed
Aug 7, 2020
- Visual entity is done - Need to make it pickable and to apply changes
- Add Quaternions functions - Add Matrices computation functions
- For now, transformations do not take well in count the orientation of the mouse but gizmo is functional.
- Use only one global FrameAction instead of having one per axis
- Translations are computed using the dot product between the mouse vector (picked position to current position) and the projected picked axis vector. Like this, the behaviour is a lot more natural and user-friendly.
- Scale is computed using the distance between the gizmo's center and the mouse. The scale unit (where nothing changes) is defined by the distance between the gizmo's center and the picked position.
- Rotation is the result angle of the mouse rotation around the gizmo's center. It is quite user-friendly.
- Special entity acting as an object container: we can add the entities we want to control with a gizmo inside it. - Drawing the gizmo always on top of the object to make sure to see it every time.
- Right clicking on the gizmo allows to reset the specific transformation.
- Moving the mouse's dependent events inside the MouseHandler and removing the FrameAction. - MouseHandler is only enabled when the gizmo is selected. There is no infinite loop waiting for an event.
- Apply the same control handling as the TransformGizmo.
- Moving transform operations from QML to Python to get access to more Qt functionalities and to make a better separation of logic/display.
- Now, we can set the transformation with a position vector, Euler angles and a scale vector.
- Checkbox in optional settings. - Parameters in advanced settings.
- Add enabled parameter to Bounding Box and update the major version of the node (important)
- Add: set value with JS Object - Add: set value from a JSON String
Now, if we change the translation of the gizmo (for instance), we make sure rotation and scale will not be changed. Very useful to avoid approximations and to have a clean undo-redo stack.
julien-hdev
force-pushed
the
dev/transformGizmo3D
branch
from
August 13, 2020 12:59
34e1f59
to
887b334
Compare
fabiencastan
approved these changes
Aug 24, 2020
This was referenced Sep 13, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Needs alicevision/AliceVision#846
Features list
To do later: use BoundingBox struct instead of Hexah in AliceVision meshing process.
Transform Gizmo
Implementation remarks
The gizmo is entirely done with Qt3D in QML. To be able to get local transformations (and not global ones), we have to deal with matrix operations. Not all the methods/functions exist in QML, so we have to implement our own functions using PySide2 in Python.
The gizmo is made with meshes. Maybe it would be better to draw it on screen directly?
The controls are pretty similar to the Blender's gizmo ones. By the way, the visual is strongly inspired by the Blender 2.8+ gizmo.
It is quite user-friendly.
How to use
EntityWithGizmo
Inside Viewer3D.qml :
Bounding Box
On the left, Meshing with default option. On the right, Meshing with the custom Bounding Box.
Implementation remarks
The Bounding Box is a simple Qt3D entity representing a box in the style of Blender. The transformations of this box are stored in the Meshing node. When we use the gizmo inside the 3D Viewer to adjust the box, the changes are sent to the Meshing node when we release the mouse button. Like this, we ensure data is stored in Python and not in QML. We can activate the use of the custom Bounding Box in the node and then adjust the parameters. In the 3D Inspector, on the right, we can show/hide the Bounding Box.
SfMTransform
To activate the gizmo, you must choose the manual mode inside method parameter. You can then adjust the parameters with the sliders and/or the gizmo.
Implementation remarks
When manual mode is set, the point cloud you see in the 3D Viewer is actually the input with a real-time Transform applied to it. Even when the node is computed, this is the transformed input which is displayed.
Fix #994